<?php

class ProductAction extends CommonAction
{

    public function _initialize() {

        parent::_initialize();
        $sid = $this->_get('category_id');
        $data = $this->_index('title','content');
        $this->assign("page", $data['page']);
        $this->assign("rows", $data['rows']); 
        $result = M('Category')->select();
        import('@.ORG.Util.Tree');
        $html = "<select id=\"category_id\" name=\"category_id\"><option selected='selected' value=''>".L('common_seleted_first')."</option>";
        $tree = new tree($result);
        $str = "<option value='\$category_id' \$selected>\$spacer\$category_name</option>";
        $html.=$tree->get_tree('2', $str, $sid);
        $html.="</select>";
        $this->assign('category',$html);
    }

    public function index() {
        $data = $this->_index(array('title','content'));

        $this->assign("page", $data['page']);
        $this->assign("rows", $data['rows']); 
        $this->display('index');
    }

    public function _before_add() {
        
    }

    public function _before_insert($modal) {

    }
    
    public function _after_insert($lastInsertId) {
        
    }
    
    public function _before_edit() {
        
        //
    }

    public function _before_update() {

    }

    public function _after_delete($ids) {
       
    }

    public function _after_update() {
          
    }

 

}